package com.sskj.run.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.run.bean.CoinTypeBean;
import com.sskj.run.bean.ZhanjiBean;
import com.sskj.run.http.HttpConfig;
import com.sskj.run.ui.fragment.UserInfoFragment;

import java.util.List;


public class UserInfoFragmentPresenter extends BasePresenter<UserInfoFragment> {

    public void getUserInfo(String money_type) {
        httpService.getZhanji(money_type)
                .execute(new JsonCallBack<HttpData<ZhanjiBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<ZhanjiBean>> response) {
                        HttpData<ZhanjiBean> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.updateUI(httpData.getData());

                        }
                    }
                });

    }
    public void getCoinType() {
        httpService.getCoinType()
                .execute(new JsonCallBack<HttpData<List<CoinTypeBean>>>() {
                    @Override
                    public void onSuccess(Response<HttpData<List<CoinTypeBean>>> response) {
                        HttpData<List<CoinTypeBean>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.initSpinner(httpData.getData());
                        }
                    }
                });
    }


}
